package tech.aistar.mapper;

import org.apache.ibatis.annotations.*;
import tech.aistar.entity.Concern;
import tech.aistar.entity.SeeRoomTrend;

import java.util.Date;
import java.util.List;

public interface SeeRoomTrendMapper {
    @Select("select * from see_room_trend")
    List<SeeRoomTrend> selectAll();

    @Insert("insert into tenant(register_id,identity) value(#{registerId},'1')")
    void insertById(Integer registerId);

    @Insert("insert into see_room_trend(house_id,see_count,see_time) value(#{houseId},'1',#{seeTime})")
    void insert(SeeRoomTrend seeRoomTrend);

    @Update("update see_room_trend set house_id=#{houseId},see_count=#{seeCount} where id=#{Id}")
    void  updateByPrimaryKey(SeeRoomTrend seeRoomTrend);
    @Update("update see_room_trend set see_count=#{see_count} where house_id=#{house_id} and see_time=#{see_time}")
    void  updateByHouseId(@Param("see_count") Integer see_count,@Param("house_id") Integer house_id, @Param("see_time")Date see_time);
    @Select("select * from see_room_trend where house_id=#{house_id} and see_time=#{see_time}")
    SeeRoomTrend selectByHouseId(@Param("house_id") Integer house_id, @Param("see_time")Date see_time);

    @Delete("delete from see_room_trend where id=#{id}")
    void deleteByPrimaryKey(Integer id);

    @Select("select * from see_room_trend order by see_count desc limit 0,3")
    List<SeeRoomTrend> selectThree();
}
